package com.davidk.survey.client.login;

import com.davidk.survey.client.eventbus.MasterEventBus;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;

@Presenter(view = LoginView.class)
public class LoginPresenter extends BasePresenter<LoginViewInterface, MasterEventBus> {
	
	@Override
	public void bind() {
		view.getButton().addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				eventBus.loginSuccess(view.getUserId().getText());
			}
			
		});
	}
	
	public void onStart() {
		//eventBus.changeBody(view.getView());
		eventBus.loginSuccess(view.getUserId().getText());
	}

}
